package com.soft.javase.day02.practice.game;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/16
 */
public class Monster {
    private String name;
    private int level;
    private int blood;
    private int power;
    private int defence;
    private String kind;

    public Monster(String name, int level, int blood, int power, int defence, String kind) {
        this.name = name;
        this.level = level;
        this.blood = blood;
        this.power = power;
        this.defence = defence;
        this.kind = kind;
    }

    // 攻击英雄
    public void attack(Hero h) {
        int damage = this.power - h.getDefence();
        if (damage <= 0) {
            System.out.println(name + " 的攻击未能破防！");
            return;
        }

        h.setBlood(h.getBlood() - damage);
        System.out.println(name + " 对 " + h.getName() + " 造成了 " + damage + " 点伤害！");
    }

    // 死亡判定
    public boolean isDead() {
        return blood <= 0;
    }

    // 显示怪兽信息
    public void show() {
        System.out.println("怪兽信息:");
        System.out.println("名称: " + name);
        System.out.println("等级: " + level);
        System.out.println("血量: " + blood);
        System.out.println("攻击力: " + power);
        System.out.println("防御力: " + defence);
        System.out.println("种族: " + kind);
        System.out.println("------------------");
    }


    public String getName() { return name; }
    public int getLevel() { return level; }
    public int getBlood() { return blood; }
    public void setBlood(int blood) { this.blood = blood; }
    public int getPower() { return power; }
    public int getDefence() { return defence; }
    public String getKind() { return kind; }

}
